#include "StdAfx.h"
#include "EString.h"

using namespace System;
using namespace Exception;

//implicit constructor
String::String ()
{
	
}
//copy constructor
String::String (const String& stringSrc)
{
	m_data.clear();
	m_data.assign(stringSrc.getString());
}

String::String (const std::wstring& string)
{
	m_data.clear();
	m_data.assign(string);
}
String::String(const LPCWSTR& string)
{
	m_data = string;
	m_data.size();
}
String::~String(void)
{
	m_data.clear();
}

const std::wstring& String::getString(void) const
{
	return (const std::wstring& )(m_data);
}

String & String::operator=(const String& string)
{
	if (this == &string)
		return *this;		
	m_data.clear();
	m_data.assign(string.getString());
	
	return *this;
}

size_t String::size(void) const
{
	return m_data.size();
}

bool String::empty(void) const
{
	return (size() == 0);
}

const wchar_t* String::c_str() const
{
	return m_data.c_str();
}

String & String::operator+=	(const String& string)
{
	String& result = *this;
	result.m_data.append(string.c_str());
	
	return result;
}

String & String::operator+=	(const LPCWSTR& string)
{
	String& result = *this;
	result.m_data.append(string);
	
	return result;
	
}